﻿//-----------------------------------------------------------------------
// <copyright file="RandomStrategy.cs" company="tuliprules.org">
//     Copyright (c) 2010 tuplelister, tuliprules.org.
// </copyright>
// <summary>This is the RandomStrategy class.</summary>
//-----------------------------------------------------------------------

namespace Tulip.Engine.ConflictResolution
{
    /// <summary>
    /// Randonm conflict resolution strategy.
    /// </summary>
    /// <remarks>
    /// Each activation is assigned a random number which is used to determine its placement 
    /// among activations of equal salience. This random number is preserved when the strategy is 
    /// changed so that the same ordering is reproduced when the random strategy is selected again 
    /// (among activations that were on the agenda when the strategy was originally changed). 
    /// </remarks>
    public class RandomStrategy : ConflictResolutionStrategy
    {
        /// <summary>
        /// Factory method returns a new agenda.
        /// </summary>
        /// <returns>A new agenda.</returns>
        public override Agenda NewAgenda()
        {
            return new Agenda(this);
        }

        /// <summary>
        /// Factory method creates a new agenda list.
        /// </summary>
        /// <returns>A new agenda list.</returns>
        public override IAgendaList CreateAgendaList()
        {
            return new RandomAgendaList();
        }
    }
}
